{extend name="adminblue/base" /}
{block name="resources"}
<style>
.table-logo{display:inline-block;width:75px;float:left;}
.table-pay{display:inline-block;width:120px;overflow:hidden;margin-top: 7px;}
.table-desc{display:inline-block;}
.pay-start,.pay-close{margin-left:0px!important;}
</style>
{/block}
{block name="main"}
<table class="table-class">
	<colgroup>
		<col width="83%">
		<col width="7%">
		<col width="10%">
	</colgroup>
	<thead>
		<tr class="table-title" style="background: white;z-index: 10;border: 1px solid #E3E3E3;">
			<th style="text-align: left;">第三方登录</th>
			<th style="text-align: center;">状态</th>
			<th style="text-align: center;">操作</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td>
				<div class="table-logo"><img src="__PUBLIC__admin/images/wchat.png"></div>
				<span class="table-pay">微信登录</span><br/>
				<span class="table-desc">提示：使用该功能需申请微信开放平台网站应用 链接：<a href="https://open.weixin.qq.com/" target="_brank">https://open.weixin.qq.com</a>
				</span>
			</td>
			{if condition="$wchat_config.is_use eq 1"}
			<td style="text-align: center;line-height:59px;">
				<a href="javascript:;" class="pay-start" status =1 onclick="set_status('WCHAT', this)" >
					<img src="ADMIN_IMG/checked.png" alt="" width="18"/>
				</a>
			</td>
			{else/}
			<td style="text-align: center;line-height:59px;">
				<a href="javascript:;" class="pay-close" status =0 onclick="set_status('WCHAT', this)" >
					<img src="ADMIN_IMG/un_checked.png" alt="" width="18"/>
				</a>
			</td>
			{/if}
			<td style="text-align: center;">
				<a href="{:__URL('ADMIN_MAIN/config/loginconfig','type=wchat')}">配置</a>
			</td>
		</tr>
		<tr>
			<td>
				<div class="table-logo"><img src="__PUBLIC__admin/images/qq.png"></div>
				<span class="table-pay">qq登录</span><br/>
				<span class="table-desc">提示：使用该功能需申请QQ互联 链接：<a href="https://connect.qq.com/" target="_brank">https://connect.qq.com</a></span> 
			</td>
			{if condition="$qq_config.is_use eq 1"}
			<td style="text-align: center;line-height:59px;">
				<a href="javascript:;" class="pay-start" status =1 onclick="set_status('QQLOGIN', this)">
					<img src="ADMIN_IMG/checked.png" alt="" width="18"/>
				</a>
			</td>
			{else/}
			<td style="text-align: center;line-height:59px;">
				<a href="javascript:;" class="pay-close" status =0 onclick="set_status('QQLOGIN', this)">
					<img src="ADMIN_IMG/un_checked.png" alt="" width="18"/>
				</a>
			</td>
			{/if}
			<td style="text-align: center;line-height:59px;">
				<a href="{:__URL('ADMIN_MAIN/config/loginconfig','type=qq')}">配置</a>
			</td>
		</tr>
	</tbody>
</table>
<script>
function set_status(type,event){
	var status = $(event).attr('status');
	if(status == 1){
		var change_status = 0;
	}else{
		var change_status = 1;
	}
	$.ajax({
		type : "post",
		url : "{:__URL('ADMIN_MAIN/config/setstatus')}",
		data : { 'is_use' : change_status, 'type' : type },
		success : function(data) {
			if (data["code"] > 0) {
				if(status == 1){
					$(event).attr('status', 0);
					$(event).find('img').attr('src', 'ADMIN_IMG/un_checked.png');
				}else{
					$(event).attr('status', 1);
					$(event).find('img').attr('src', 'ADMIN_IMG/checked.png');
				}
				showTip(data["message"],'success');
			}else{
				showTip(data["message"],'error');
			}
		}
	});
}
</script>
{/block}